function F = DSGEforesight_N(Z,x_t,y_tN,N,setupEPer)
 
%Unfold some elements in setupEper
nx        = setupEPer.nx;
mx        = setupEPer.mx;
myx       = setupEPer.myx;
ny        = setupEPer.ny;
params    = setupEPer.params;
hx        = setupEPer.hx;
 
%Unfold params
BETTA= params.BETTA;
B= params.B;
CHI= params.CHI;
CHI0= params.CHI0;
THETA= params.THETA;
DELTA= params.DELTA;
ALFA= params.ALFA;
PHI= params.PHI;
PHIzero= params.PHIzero;
ZI= params.ZI;
KAPAw= params.KAPAw;
ETA= params.ETA;
RHOR= params.RHOR;
PHIpai= params.PHIpai;
PHIpai_1= params.PHIpai_1;
PHIy= params.PHIy;
PHIy_1= params.PHIy_1;
PHIc= params.PHIc;
PHIc_1= params.PHIc_1;
PHIl= params.PHIl;
NU= params.NU;
U0= params.U0;
U0d= params.U0d;
OMEGAz= params.OMEGAz;
OMEGAd= params.OMEGAd;
OMEGAn= params.OMEGAn;
OMEGAp= params.OMEGAp;
OMEGAa= params.OMEGAa;
RHOz= params.RHOz;
RHOd= params.RHOd;
RHOn= params.RHOn;
RHOp= params.RHOp;
RHOa= params.RHOa;
Kss= params.Kss;
OUTPUTss= params.OUTPUTss;
PAIss= params.PAIss;
MUZss= params.MUZss;
Css= params.Css;
AA= params.AA;
lss= params.lss;
Rss= params.Rss;
Wss= params.Wss;
 
% Retrieving stacked variables
[x,y] = VarStack(Z,nx,mx,myx,ny,hx,x_t,y_tN,N);
 
% Adding the level to the variables
y = y + repmat(transpose(setupEPer.g0),N+1,1);
x = x + repmat(transpose(setupEPer.h0),N+1,1);
 
% Current values in the model;
% x(N,mx) y(N,ny);
% x;
c_ba1 = x(1:N,1);
muz_cu = x(1:N,2);
d_cu = x(1:N,3);
n_cu = x(1:N,4);
paistar_cu = x(1:N,5);
a_cu = x(1:N,6);
% xp;
c_ba1p = x(2:N+1,1);
muz_cup = x(2:N+1,2);
d_cup = x(2:N+1,3);
n_cup = x(2:N+1,4);
paistar_cup = x(2:N+1,5);
a_cup = x(2:N+1,6);
 
% y
c_cu = y(1:N,1);
r_cu = y(1:N,2);
pai_cu = y(1:N,3);
w_cu = y(1:N,4);
l_cu = y(1:N,5);
output_cu = y(1:N,6);
mc_cu = y(1:N,7);
evf_cu = y(1:N,8);
vf_cu = y(1:N,9);
p1_cu = y(1:N,10);
p2_cu = y(1:N,11);
p3_cu = y(1:N,12);
p4_cu = y(1:N,13);
p5_cu = y(1:N,14);
p6_cu = y(1:N,15);
p7_cu = y(1:N,16);
p8_cu = y(1:N,17);
p9_cu = y(1:N,18);
p10_cu = y(1:N,19);
p11_cu = y(1:N,20);
p12_cu = y(1:N,21);
p13_cu = y(1:N,22);
p14_cu = y(1:N,23);
p15_cu = y(1:N,24);
p16_cu = y(1:N,25);
p17_cu = y(1:N,26);
p18_cu = y(1:N,27);
p19_cu = y(1:N,28);
p20_cu = y(1:N,29);
p21_cu = y(1:N,30);
p22_cu = y(1:N,31);
p23_cu = y(1:N,32);
p24_cu = y(1:N,33);
p25_cu = y(1:N,34);
p26_cu = y(1:N,35);
p27_cu = y(1:N,36);
p28_cu = y(1:N,37);
p29_cu = y(1:N,38);
p30_cu = y(1:N,39);
p31_cu = y(1:N,40);
p32_cu = y(1:N,41);
p33_cu = y(1:N,42);
p34_cu = y(1:N,43);
p35_cu = y(1:N,44);
p36_cu = y(1:N,45);
p37_cu = y(1:N,46);
p38_cu = y(1:N,47);
p39_cu = y(1:N,48);
p40_cu = y(1:N,49);
% yp;
c_cup = y(2:N+1,1);
r_cup = y(2:N+1,2);
pai_cup = y(2:N+1,3);
w_cup = y(2:N+1,4);
l_cup = y(2:N+1,5);
output_cup = y(2:N+1,6);
mc_cup = y(2:N+1,7);
evf_cup = y(2:N+1,8);
vf_cup = y(2:N+1,9);
p1_cup = y(2:N+1,10);
p2_cup = y(2:N+1,11);
p3_cup = y(2:N+1,12);
p4_cup = y(2:N+1,13);
p5_cup = y(2:N+1,14);
p6_cup = y(2:N+1,15);
p7_cup = y(2:N+1,16);
p8_cup = y(2:N+1,17);
p9_cup = y(2:N+1,18);
p10_cup = y(2:N+1,19);
p11_cup = y(2:N+1,20);
p12_cup = y(2:N+1,21);
p13_cup = y(2:N+1,22);
p14_cup = y(2:N+1,23);
p15_cup = y(2:N+1,24);
p16_cup = y(2:N+1,25);
p17_cup = y(2:N+1,26);
p18_cup = y(2:N+1,27);
p19_cup = y(2:N+1,28);
p20_cup = y(2:N+1,29);
p21_cup = y(2:N+1,30);
p22_cup = y(2:N+1,31);
p23_cup = y(2:N+1,32);
p24_cup = y(2:N+1,33);
p25_cup = y(2:N+1,34);
p26_cup = y(2:N+1,35);
p27_cup = y(2:N+1,36);
p28_cup = y(2:N+1,37);
p29_cup = y(2:N+1,38);
p30_cup = y(2:N+1,39);
p31_cup = y(2:N+1,40);
p32_cup = y(2:N+1,41);
p33_cup = y(2:N+1,42);
p34_cup = y(2:N+1,43);
p35_cup = y(2:N+1,44);
p36_cup = y(2:N+1,45);
p37_cup = y(2:N+1,46);
p38_cup = y(2:N+1,47);
p39_cup = y(2:N+1,48);
p40_cup = y(2:N+1,49);
 
%% Setting the dimension of the matrices 
f = zeros(ny+mx,N);
%% f Function evaluation
% START DISPLAYING f
f(1,:)=exp(-vf_cu).*(exp(d_cu).*(((exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1))./Css.^CHI0).^(1 - CHI)./(CHI - 1) - U0d + (PHIzero.*exp(n_cu).*(1 - exp(l_cu)).^(1 - 1./PHI))./(1./PHI - 1)) - U0 + (AA.*BETTA)./exp(evf_cu).^(1./(ALFA - 1))) - 1;
f(2,:)=exp(-w_cu).*(KAPAw.*Wss - (Css.^CHI0.*PHIzero.*exp(n_cu).*((exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1))./Css.^CHI0).^CHI.*(KAPAw - 1))./(1 - exp(l_cu)).^(1./PHI)) - 1;
f(3,:)=(BETTA.*exp(-d_cu).*exp(-pai_cup).*exp(d_cup).*exp(r_cu).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(4,:)=- (exp(-a_cu).*exp(-mc_cu).*exp(w_cu).*exp(l_cu).^THETA)./(Kss.^THETA.*(THETA - 1)) - 1;
f(5,:)=1 - (exp(-mc_cu).*(ETA + (ZI.*exp(pai_cu).*(exp(pai_cu)./PAIss.^NU - 1))./PAIss.^NU - (BETTA.*ZI.*exp(-d_cu).*exp(-output_cu).*exp(d_cup).*exp(muz_cup).*exp(output_cup).*exp(pai_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*(exp(pai_cup)./PAIss.^NU - 1).*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(PAIss.^NU.*(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI) - 1))./ETA;
f(6,:)=Rss.*exp(PHIl.*log(exp(l_cu)./lss) + PHIc.*(log(exp(muz_cu)) - log(MUZss) - exp(c_ba1) + exp(c_cu)) + PHIc_1.*(log(exp(muz_cup)) - log(MUZss) - exp(c_ba1p) + exp(c_cup)) - PHIpai.*(log(exp(paistar_cu)) - log(exp(pai_cu)) + log(PAIss)) - PHIpai_1.*(log(exp(paistar_cup)) - log(exp(pai_cup)) + log(PAIss)) + PHIy.*log(exp(output_cu)./OUTPUTss) + PHIy_1.*log(exp(output_cup)./OUTPUTss)) - exp(r_cu);
f(7,:)=(exp(output_cu).*((ZI.*(exp(pai_cu)./PAIss.^NU - 1).^2)./2 - 1))./(exp(c_cu) + DELTA.*Kss) + 1;
f(8,:)=Kss.^THETA.*exp(-output_cu).*exp(a_cu).*exp(l_cu).^(1 - THETA) - 1;
f(9,:)=exp(-evf_cu).*((exp(vf_cup).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))./AA).^(1 - ALFA) - 1;
f(10,:)=exp(-p1_cu).*exp(-r_cu) - 1;
f(11,:)=(BETTA.*exp(-d_cu).*exp(-p2_cu).*exp(-pai_cup).*exp(d_cup).*exp(p1_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(12,:)=(BETTA.*exp(-d_cu).*exp(-p3_cu).*exp(-pai_cup).*exp(d_cup).*exp(p2_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(13,:)=(BETTA.*exp(-d_cu).*exp(-p4_cu).*exp(-pai_cup).*exp(d_cup).*exp(p3_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(14,:)=(BETTA.*exp(-d_cu).*exp(-p5_cu).*exp(-pai_cup).*exp(d_cup).*exp(p4_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(15,:)=(BETTA.*exp(-d_cu).*exp(-p6_cu).*exp(-pai_cup).*exp(d_cup).*exp(p5_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(16,:)=(BETTA.*exp(-d_cu).*exp(-p7_cu).*exp(-pai_cup).*exp(d_cup).*exp(p6_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(17,:)=(BETTA.*exp(-d_cu).*exp(-p8_cu).*exp(-pai_cup).*exp(d_cup).*exp(p7_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(18,:)=(BETTA.*exp(-d_cu).*exp(-p9_cu).*exp(-pai_cup).*exp(d_cup).*exp(p8_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(19,:)=(BETTA.*exp(-d_cu).*exp(-p10_cu).*exp(-pai_cup).*exp(d_cup).*exp(p9_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(20,:)=(BETTA.*exp(-d_cu).*exp(-p11_cu).*exp(-pai_cup).*exp(d_cup).*exp(p10_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(21,:)=(BETTA.*exp(-d_cu).*exp(-p12_cu).*exp(-pai_cup).*exp(d_cup).*exp(p11_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(22,:)=(BETTA.*exp(-d_cu).*exp(-p13_cu).*exp(-pai_cup).*exp(d_cup).*exp(p12_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(23,:)=(BETTA.*exp(-d_cu).*exp(-p14_cu).*exp(-pai_cup).*exp(d_cup).*exp(p13_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(24,:)=(BETTA.*exp(-d_cu).*exp(-p15_cu).*exp(-pai_cup).*exp(d_cup).*exp(p14_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(25,:)=(BETTA.*exp(-d_cu).*exp(-p16_cu).*exp(-pai_cup).*exp(d_cup).*exp(p15_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(26,:)=(BETTA.*exp(-d_cu).*exp(-p17_cu).*exp(-pai_cup).*exp(d_cup).*exp(p16_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(27,:)=(BETTA.*exp(-d_cu).*exp(-p18_cu).*exp(-pai_cup).*exp(d_cup).*exp(p17_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(28,:)=(BETTA.*exp(-d_cu).*exp(-p19_cu).*exp(-pai_cup).*exp(d_cup).*exp(p18_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(29,:)=(BETTA.*exp(-d_cu).*exp(-p20_cu).*exp(-pai_cup).*exp(d_cup).*exp(p19_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(30,:)=(BETTA.*exp(-d_cu).*exp(-p21_cu).*exp(-pai_cup).*exp(d_cup).*exp(p20_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(31,:)=(BETTA.*exp(-d_cu).*exp(-p22_cu).*exp(-pai_cup).*exp(d_cup).*exp(p21_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(32,:)=(BETTA.*exp(-d_cu).*exp(-p23_cu).*exp(-pai_cup).*exp(d_cup).*exp(p22_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(33,:)=(BETTA.*exp(-d_cu).*exp(-p24_cu).*exp(-pai_cup).*exp(d_cup).*exp(p23_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(34,:)=(BETTA.*exp(-d_cu).*exp(-p25_cu).*exp(-pai_cup).*exp(d_cup).*exp(p24_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(35,:)=(BETTA.*exp(-d_cu).*exp(-p26_cu).*exp(-pai_cup).*exp(d_cup).*exp(p25_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(36,:)=(BETTA.*exp(-d_cu).*exp(-p27_cu).*exp(-pai_cup).*exp(d_cup).*exp(p26_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(37,:)=(BETTA.*exp(-d_cu).*exp(-p28_cu).*exp(-pai_cup).*exp(d_cup).*exp(p27_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(38,:)=(BETTA.*exp(-d_cu).*exp(-p29_cu).*exp(-pai_cup).*exp(d_cup).*exp(p28_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(39,:)=(BETTA.*exp(-d_cu).*exp(-p30_cu).*exp(-pai_cup).*exp(d_cup).*exp(p29_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(40,:)=(BETTA.*exp(-d_cu).*exp(-p31_cu).*exp(-pai_cup).*exp(d_cup).*exp(p30_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(41,:)=(BETTA.*exp(-d_cu).*exp(-p32_cu).*exp(-pai_cup).*exp(d_cup).*exp(p31_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(42,:)=(BETTA.*exp(-d_cu).*exp(-p33_cu).*exp(-pai_cup).*exp(d_cup).*exp(p32_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(43,:)=(BETTA.*exp(-d_cu).*exp(-p34_cu).*exp(-pai_cup).*exp(d_cup).*exp(p33_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(44,:)=(BETTA.*exp(-d_cu).*exp(-p35_cu).*exp(-pai_cup).*exp(d_cup).*exp(p34_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(45,:)=(BETTA.*exp(-d_cu).*exp(-p36_cu).*exp(-pai_cup).*exp(d_cup).*exp(p35_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(46,:)=(BETTA.*exp(-d_cu).*exp(-p37_cu).*exp(-pai_cup).*exp(d_cup).*exp(p36_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(47,:)=(BETTA.*exp(-d_cu).*exp(-p38_cu).*exp(-pai_cup).*exp(d_cup).*exp(p37_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(48,:)=(BETTA.*exp(-d_cu).*exp(-p39_cu).*exp(-pai_cup).*exp(d_cup).*exp(p38_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
f(49,:)=(BETTA.*exp(-d_cu).*exp(-p40_cu).*exp(-pai_cup).*exp(d_cup).*exp(p39_cup).*exp(muz_cup).^(CHI.*(CHI0 - 1) - CHI0).*(exp(c_cu) - B.*exp(-muz_cu).*exp(c_ba1)).^CHI.*((AA.*exp(-vf_cup))./(exp(evf_cu).^(1./(ALFA - 1)).*exp(muz_cup).^((CHI - 1).*(CHI0 - 1)))).^ALFA)./(exp(c_cup) - B.*exp(-muz_cup).*exp(c_cu)).^CHI - 1;
% END DISPLAYING f
 
F = reshape(f,N*(ny+mx),1);
end
